package com.ljl;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;

/**
 * @author ljl
 * @version 1.0
 * @date 2022/10/26 9:48
 */
public class ServerHandler extends IoHandlerAdapter {

    @Override
    public void messageReceived(IoSession session, Object message) throws Exception {
        System.out.printf("接收到来自[%s]的消息[%s]\r\n", session.getRemoteAddress().toString(), message);
        //返回消息给客户端
        System.out.println("发送消息[ok!]");
        session.write("ok!");
    }

}
